/*
** termcaps.c for my_select in /home/nadali_t//local/svn/tek2ed/my_select
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Sun Nov 25 17:32:21 2012 thomas nadalie
** Last update Sun Nov 25 17:34:00 2012 thomas nadalie
*/

#include	"my.h"
#include        <curses.h>
#include        <unistd.h>
#include	<termios.h>
#include	<term.h>

void            raw_mode(struct termios *t)
{
  t->c_lflag &= ~ICANON;
  t->c_lflag &= ~ECHO;
  t->c_cc[VMIN] = 1;
  if (tcsetattr(0, TCSANOW, t) == -1)
    my_put_error("Tcsetattr failed\n");
}

void            react_echo(struct termios *t)
{
  t->c_lflag |= ECHO;
  t->c_lflag |= ICANON;
  if (tcsetattr(0, 0, t) == -1)
    my_put_error("Tcsetattr failed\n");
}


void		clear_s()
{
  if (tgetent(0, "xterm") != 1)
    my_put_error("No such entry or terminfo database coud not be found\n");
  tputs(tgetstr("cl", 0), 1, my_putchar);
}
